package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.distribution.dos.DistributionGoods;
import com.enation.app.javashop.service.distribution.DistributionGoodsManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 分销商品客户端 controller
 *
 * @author liushuai(liushuai711@gmail.com)
 * @version v1.0
 * @Description:
 * @since v7.0
 * 2018/8/14 下午1:31
 */
@RestController
@RequestMapping("/client/distribution")
@Validated
@ApiIgnore
public class DistributionGoodsClientController {

    @Autowired
    private DistributionGoodsManager distributionGoodsManager;

    @GetMapping("/goods/{goods_id}")
    public DistributionGoods getModel(@PathVariable("goods_id") Long goodsId) {
        return distributionGoodsManager.getModel(goodsId);
    }

    /**
     * 修改分销商品提现设置
     *
     * @param distributionGoods
     * @return
     */
    @RequestMapping(value = "/goods/edit", method = RequestMethod.POST)
    public DistributionGoods edit(@RequestBody DistributionGoods distributionGoods) {
        return distributionGoodsManager.edit(distributionGoods);
    }

    @RequestMapping(value = "/goods/{goods_id}/del", method = RequestMethod.POST)
    public void delete(@PathVariable("goods_id")Long id) {
        distributionGoodsManager.delete(id);
    }

}
